home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / music / musgfa.zoo / musex2.lst < prev    next >
File List  |  1992-12-24  |  10KB  |  407 lines

  1. ' musex2.gfa by Seymour Shlien/ 624 Courtenay Avenue / Ottawa, Canada, K2A 3B5
  2. ' december 20 1992
  3. DIM topname$(32)
  4. DIM botname$(32)
  5. DIM but_left%(32),but_right%(32),but_top%(32),but_bot%(32)
  6. DIM but_status%(32)
  7. DIM sel_left%(16),sel_right%(16),sel_top%(16),sel_bot%(16)
  8. DIM top_sel_name$(16),bot_sel_name$(16)
  9. DIM int_list%(11),key_list%(12),d_list%(2)
  10. octave%=4
  11. tone%=2
  12. chord%=0
  13. @load_names
  14. sel_num%=0
  15. DEFMOUSE 0
  16. DO WHILE sel_num%<>bot_panel%+1
  17.   @display_all_selectors
  18.   sel_num%=@selector
  19.   IF sel_num%=bot_panel%+2
  20.     @instructions
  21.   ELSE
  22.     @make_board
  23.     @display_board
  24.     @exercise
  25.   ENDIF
  26. LOOP
  27. > PROCEDURE load_names
  28.   LOCAL i%,istart%,iend%
  29.   istart%=0
  30.   iend%=10
  31.   '
  32.   ' intervals
  33.   FOR i%=istart% TO iend%
  34.     READ botname$(i%)
  35.   NEXT i%
  36.   FOR i%=istart% TO iend%
  37.     READ topname$(i%)
  38.   NEXT i%
  39.   FOR i%=istart% TO iend%
  40.     but_left%(i%)=MOD(i%,4)*80+5
  41.     but_right%(i%)=MOD(i%,4)*80+72
  42.     but_top%(i%)=(i% DIV 4)*28
  43.     but_bot%(i%)=(i% DIV 4)*28+24
  44.     but_status%(i%)=0
  45.   NEXT i%
  46.   istart%=iend%+1
  47.   iend%=iend%+12
  48.   '
  49.   ' keys
  50.   FOR i%=istart% TO iend%
  51.     READ topname$(i%)
  52.   NEXT i%
  53.   FOR i%=istart% TO iend%
  54.     but_left%(i%)=MOD(i%-istart%,4)*30+5
  55.     but_right%(i%)=MOD(i%-istart%,4)*30+28
  56.     but_top%(i%)=((i%-istart%) DIV 4)*28+85
  57.     but_bot%(i%)=((i%-istart%) DIV 4)*28+20+85
  58.     but_status%(i%)=0
  59.   NEXT i%
  60.   istart%=iend%+1
  61.   iend%=iend%+2
  62.   '
  63.   ' ascend/descend
  64.   FOR i%=istart% TO iend%
  65.     READ topname$(i%)
  66.   NEXT i%
  67.   iend%=iend%+3
  68.   FOR i%=istart% TO iend%
  69.     but_left%(i%)=160+80*MOD(i%-istart%,2)
  70.     but_right%(i%)=but_left%(i%)+72
  71.     but_top%(i%)=((i%-istart%) DIV 2)*20+85
  72.     but_bot%(i%)=but_top%(i%)+16
  73.     but_status%(i%)=0
  74.   NEXT i%
  75.   topname$(iend%-2)="octave 4"
  76.   topname$(iend%-1)="tone "+STR$(tone%)
  77.   topname$(iend%)="  broken"
  78.   botname$(iend%)="  chord"
  79.   but_bot%(iend%)=but_top%(iend%)+24
  80.   istart%=iend%+1
  81.   iend%=iend%+3
  82.   bot_panel%=istart%
  83.   but_status%(3)=1
  84.   but_status%(5)=1
  85.   but_status%(11)=1
  86.   but_status%(23)=1
  87.   FOR i%=istart% TO iend%
  88.     READ topname$(i%)
  89.   NEXT i%
  90.   FOR i%=istart% TO iend%
  91.     but_left%(i%)=(i%-istart%)*70+5
  92.     but_right%(i%)=but_left%(i%)+60
  93.     but_top%(i%)=170
  94.     but_bot%(i%)=182
  95.     but_status%(i%)=0
  96.   NEXT i%
  97.   but_right%(iend%)=but_left%(iend%)+110
  98.   istart%=iend%
  99.   DATA second,second,third,third,fourth,fifth,sixth,sixth,seventh,seventh,octave
  100.   DATA minor,major,minor,major,perfect,perfect,minor,major,minor,major,
  101.   DATA C,C#,D,D#,E,F,F#,G,G#,A,A#,B
  102.   DATA ascend,descend
  103.   DATA ready,quit,instructions
  104. RETURN
  105. > PROCEDURE display_selector(i%)
  106.   BOX but_left%(i%),but_top%(i%),but_right%(i%),but_bot%(i%)
  107.   DEFFILL but_status%(i%)
  108.   PBOX but_left%(i%)+1,but_top%(i%)+1,but_right%(i%)-1,but_bot%(i%)-1
  109.   GRAPHMODE 2
  110.   DEFTEXT 1-but_status%(i%)
  111.   TEXT but_left%(i%)+5,but_top%(i%)+8,topname$(i%)
  112.   TEXT but_left%(i%)+5,but_top%(i%)+18,botname$(i%)
  113. RETURN
  114. > PROCEDURE display_all_selectors
  115.   LOCAL i%
  116.   CLS
  117.   FOR i%=0 TO 30
  118.     display_selector(i%)
  119.   NEXT i%
  120. RETURN
  121. > FUNCTION select_button
  122. LOCAL i%
  123. SHOWM
  124. REPEAT
  125. UNTIL MOUSEK<>0
  126. FOR i%=0 TO 30
  127.   IF MOUSEX>but_left%(i%)
  128.     IF MOUSEX<but_right%(i%)
  129.       IF MOUSEY>but_top%(i%)
  130.         IF MOUSEY<but_bot%(i%)
  131.           IF i%>=0 AND i%<25
  132.             but_status%(i%)=1-but_status%(i%)
  133.             @make_board
  134.             IF int_size%>0 AND key_size%>0 AND d_size%>0
  135.               @display_selector(i%)
  136.             ELSE
  137.               but_status%(i%)=1-but_status%(i%)
  138.             ENDIF
  139.           ENDIF
  140.           IF i%=25
  141.             INC octave%
  142.             IF octave%>5
  143.               octave%=3
  144.             ENDIF
  145.             topname$(i%)="octave "+STR$(octave%)
  146.             @display_selector(i%)
  147.           ENDIF
  148.           IF i%=26
  149.             tone%=MOD(tone%+1,3)
  150.             topname$(i%)="tone "+STR$(tone%)
  151.             @display_selector(i%)
  152.           ENDIF
  153.           IF i%=27
  154.             chord%=1-chord%
  155.             IF chord%=1
  156.               topname$(i%)=""
  157.             ELSE
  158.               topname$(i%)="  broken"
  159.             ENDIF
  160.             @display_selector(i%)
  161.           ENDIF
  162.           PAUSE 20
  163.           RETURN i%
  164.         ENDIF
  165.       ENDIF
  166.     ENDIF
  167.   ENDIF
  168. NEXT i%
  169. RETURN -1
  170. ENDFUNC
  171. > FUNCTION selector
  172. LOCAL i%
  173. REPEAT
  174. i%=@select_button
  175. IF i%=bot_panel%+1
  176.   END
  177. ENDIF
  178. UNTIL i%>27
  179. RETURN i%
  180. ENDFUNC
  181. > PROCEDURE make_board
  182. LOCAL i%
  183. int_size%=0
  184. FOR i%=0 TO 10
  185. IF but_status%(i%)=1
  186.   int_list%(int_size%)=i%
  187.   sel_left%(int_size%)=MOD(int_size%,4)*80+5
  188.   sel_right%(int_size%)=MOD(int_size%,4)*80+72
  189.   sel_top%(int_size%)=(int_size% DIV 4)*32+96
  190.   sel_bot%(int_size%)=(int_size% DIV 4)*32+24+96
  191.   top_sel_name$(int_size%)=topname$(i%)
  192.   bot_sel_name$(int_size%)=botname$(i%)
  193.   int_size%=int_size%+1
  194. ENDIF
  195. NEXT i%
  196. sel_left%(int_size%)=5
  197. sel_right%(int_size%)=80
  198. sel_top%(int_size%)=10
  199. sel_bot%(int_size%)=34
  200. top_sel_name$(int_size%)="quit"
  201. bot_sel_name$(int_size%)=""
  202. sel_left%(int_size%+1)=85
  203. sel_right%(int_size%+1)=170
  204. sel_top%(int_size%+1)=10
  205. sel_bot%(int_size%+1)=34
  206. top_sel_name$(int_size%+1)="repeat"
  207. bot_sel_name$(int_size%+1)=""
  208. sel_left%(int_size%+2)=175
  209. sel_right%(int_size%+2)=225
  210. sel_top%(int_size%+2)=10
  211. sel_bot%(int_size%+2)=34
  212. top_sel_name$(int_size%+2)="help"
  213. bot_sel_name$(int_size%+2)=""
  214. key_size%=0
  215. FOR i%=11 TO 22
  216. IF but_status%(i%)=1
  217.   key_list%(key_size%)=i%-10
  218.   INC key_size%
  219. ENDIF
  220. NEXT i%
  221. d_size%=0
  222. FOR i%=23 TO 24
  223. IF but_status%(i%)=1
  224.   d_list%(d_size%)=i%-22
  225.   INC d_size%
  226. ENDIF
  227. NEXT i%
  228. RETURN
  229. > PROCEDURE display_sel(i%,highlight%)
  230. GRAPHMODE 2
  231. IF (i%<25)
  232. DEFFILL highlight%
  233. DEFTEXT 1-highlight%
  234. BOX sel_left%(i%),sel_top%(i%),sel_right%(i%),sel_bot%(i%)
  235. PBOX sel_left%(i%)+1,sel_top%(i%)+1,sel_right%(i%)-1,sel_bot%(i%)-1
  236. TEXT sel_left%(i%)+5,sel_top%(i%)+8,top_sel_name$(i%)
  237. TEXT sel_left%(i%)+5,sel_top%(i%)+18,bot_sel_name$(i%)
  238. ENDIF
  239. RETURN
  240. > PROCEDURE display_board
  241. LOCAL i%
  242. CLS
  243. FOR i%=0 TO int_size%+2
  244. display_sel(i%,0)
  245. NEXT i%
  246. RETURN
  247. > PROCEDURE interval(note1%,octave1%,note2%,octave2%)
  248. IF chord%=0
  249. SOUND 0,10,note1%,octave1%,0
  250. WAVE 1,3,0,1000+3000*tone%,25
  251. SOUND 0,10,note2%,octave2%,0
  252. WAVE 1,3,0,1000+3000*tone%,25
  253. SOUND 0,0,note1%,octave1%,0
  254. ELSE
  255. SOUND 1,10,note1%,octave1%,0
  256. SOUND 2,10,note2%,octave2%,0
  257. WAVE 3,3,0,3000*(tone%+1),25
  258. SOUND 1,0,note1%,octave1%,0
  259. SOUND 2,0,note1%,octave1%,0
  260. ENDIF
  261. RETURN
  262. > FUNCTION select_answer
  263. LOCAL i%
  264. SHOWM
  265. REPEAT
  266. UNTIL MOUSEK<>0
  267. FOR i%=0 TO 16
  268. IF MOUSEX>sel_left%(i%)
  269. IF MOUSEX<sel_right%(i%)
  270.   IF MOUSEY>sel_top%(i%)
  271.     IF MOUSEY<sel_bot%(i%)
  272.       PAUSE 20
  273.       RETURN i%
  274.     ENDIF
  275.   ENDIF
  276. ENDIF
  277. ENDIF
  278. NEXT i%
  279. RETURN -1
  280. ENDFUNC
  281. > PROCEDURE exercise
  282. LOCAL i%,note1%,note2%,octave1%,octave2%
  283. LOCAL int%
  284. correct%=0
  285. total%=0
  286. REPEAT
  287. INC total%
  288. trys%=0
  289. octave1%=octave%
  290. octave2%=octave%
  291. note1%=RANDOM(key_size%)
  292. note1%=key_list%(note1%)
  293. d%=RANDOM(d_size%)
  294. d%=d_list%(d%)
  295. int%=RANDOM(int_size%)
  296. note2%=int_list%(int%)+1
  297. IF d%=1
  298. note2%=note1%+note2%
  299. ELSE
  300. note2%=note1%-note2%
  301. ENDIF
  302. IF note2%>12
  303. note2%=note2%-12
  304. octave2%=octave2%+1
  305. ENDIF
  306. IF note2%<1
  307. note2%=note2%+12
  308. octave2%=octave2%-1
  309. ENDIF
  310. @interval(note1%,octave1%,note2%,octave2%)
  311. REPEAT
  312. ans%=@select_answer
  313. IF ans%=int_size%+1
  314.   @interval(note1%,octave1%,note2%,octave2%)
  315. ENDIF
  316. IF ans%=int_size%+2
  317.   @help(note1%,octave1%,d%)
  318. ENDIF
  319. INC trys%
  320. LOCATE 1,7
  321. IF ans%=int%
  322.   PRINT SPACE$(10);
  323. ELSE IF ans%<>int_size%
  324.   PRINT SPACE$(10);
  325.   @interval(note1%,octave1%,note2%,octave2%)
  326.   LOCATE 1,7
  327.   PRINT "TRY AGAIN";
  328. ENDIF
  329. UNTIL ans%=int% OR ans%=int_size%
  330. IF trys%=1 AND ans%<>int_size%
  331. INC correct%
  332. LOCATE 1,7
  333. PRINT "good"
  334. LOCATE 1,8
  335. PRINT "score =";correct%;"/";total%;
  336. PAUSE 25
  337. ENDIF
  338. UNTIL ans%=int_size%
  339. CLS
  340. RETURN
  341. > PROCEDURE instructions
  342. CLS
  343. PRINT " MUSICAL INTERVAL RECOGNITION  92-12-20"
  344. PRINT
  345. PRINT "This is an ear training exercise for"
  346. PRINT "developing the ability to identify the"
  347. PRINT "musical intervals. For example a "
  348. PRINT "perfect fifth is the interval between C"
  349. PRINT "and G or D and A. The program plays an"
  350. PRINT "inteval using the Atari sou